Email: wei7758@126.com
Blog: http://blog.csdn.net/yinwei520
Author: yww
Time: 2011-9-24
Update:
(Please specify the source for reprinting. Thank you)
Here we reference the explanation in the book "Android system-level deep development-porting and debugging". The real vibrator code analysis is based on the Code in my project.
I. vibrator system structure and porting content
The
System services provided by Android-Vibrator and android-vibrator
Vibrator, a system service provided by Android)
-- Reprinted with the source: coder-pig
Vibrator introduction and related methods:
Simple demo -- set frequencyDifferent Vibrator
The most widely used ap
Transferred from[It168 Technology]
As developers, we all know that the vibrator is responsible for controlling the vibration function of the mobile phone. The Vibrator System in Android is a small system dedicated to this function and provides the time-based Vibration function.
The vibrator system includes the driver, hardware abstraction layer, JNI, and Java fr
Objective:
Vibrator Introduction:
Let's write a simple example to familiarize ourselves with the use of this vibrator!
1. Obtain Vibrator Examples:
Vibrator vb = (vibrator) getsystemservice (Service.vibrator_service);
2. The relevant methods that can be use
Android basics tutorial-10.4 Vibrator (Vibrator)
This section introduces:
This section describesVibrator(Vibrator), is the vibrator that comes with the mobile phone, do not go to Baidu to directly search for the vibrator, becauseYour search results may be mysterious items,
Tags:androidvibrator Vibrator It
Category: Andorid
Get the Vibrator Vibrator instance: Vibrator Mvibrator = (vibrator) context.getsystemservice (Context.vibrator_service); Vibrator.vibrate () Method: When there are only 1 parameters, the first parameter
Android This system provides service--vibrator (vibrator) --Reprint Please specify source: Coder-pig Vibrator Simple introduction and related methods:watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy29kzxjfcgln/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">simple demo--Set frequency different VibratorsThe most widely used for
The vibrator Vibrator is a service that Android gives us for the vibration of the fuselage , for example, when we receive a push message, we can set up a vibrating alert, or we can use it to enhance the interactivity of the player.Run:Program Structure Package= "Com.example.administrator.myapplication" > Application Android:allowbackup= "true"Android:icon= "@mipmap/ic_launcher"Android:label= "@string/app_na
Heartbeat vibration Vibrator Used, heartbeat vibration vibrator
The device vibrator can be used to set the vibration frequency to simulate the heartbeat vibration.
There are two ways to obtain the device vibrator:
Vibrator = (Vibrator
Androidmanifest.xml Getting system permissionsVibration is realized by vibratorVibrator Mvibrator = (vibrator) mcontext.getsystemservice (Service.vibrator_service); //The previous parameter is the set vibration period array, the second parameter is the number of vibrations (-1 means shaking only once, 0 vibrations will continue)or directly set the vibration duration mvibrator.vibrate (5000);Long[] Pattern = {100};mvibrator.vibrate (pattern,-1);//Cance
Mobile phones have the effect of vibration. The day before yesterday, the flying knife removed a vibrator from the mobile phone, and asked me to tune it next week. Yesterday, I came to the company for a test and got it done. Let's talk about the process below.
In fact, the underlying driver has been completed in Android, that is, timed_gpio, which combines the timing function with the gpio function. vibration is a small DC motor, when the gpio port is
Android mobile phone vibration settings (vibrator) Steps:
A, through the system services to obtain mobile phone vibration services, vibrator vibrator = (Vibrator) getsystemservice (Vibrator_service);
b, after the vibration service to detect the existence of vibrator:
Vibra
Platform MTK6573
Android Vibrator System Architecture
I. Driver Layer
Modify and add Linux kernel files for Android
/kernel/drivers/staging/android/timed_output.h/kernel/drivers/staging/android/timed_output.c
Timed_output.h defines the timed_output_dev struct.
structtimed_output_dev{
constchar*name;
/*enabletheoutputandsetthetimer*/
void(*enable)(structtimed_output_dev*sdev,inttimeout);
/
1. The code I wrote earlier is as follows:1 Packagecom.himi.vibrate;2 3 Importandroid.app.Activity;4 ImportAndroid.app.Service;5 ImportAndroid.content.res.AssetManager;6 ImportAndroid.graphics.Typeface;7 ImportAndroid.os.Bundle;8 ImportAndroid.os.Vibrator;9 ImportAndroid.view.View;Ten ImportAndroid.view.View.OnClickListener; One ImportAndroid.widget.Button; A - Public classMainactivityextendsActivityImplementsOnclicklistener { - PrivateButton Btnlow; the PrivateButton Btnnormal; -
in the Androidmainfest.xml declaring vibration permissions in a fileGet mobile phone vibration services through system services, such asVibrator vibrator= (Vibrator) Getsystemservice (Vibrator_service)Get vibration service after detection Vibrator is present, asVibrator.hasvibrator ();returns false if there is trueMake appropriate calls based on actual needs, suc
The vibrations in Android phones are implemented by vibrator. To set a vibration event, you need to know the length of the vibration, the period of vibration and so on.In Android vibrator, the vibration time is calculated in milliseconds (1/1000 seconds), so if the set time value is too small, it will not feel.Implemented by calling Vibrator's vibrate (long[] pattern, int repeat) method.The previous paramet
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.